package com.gitee.chenyaohua.oa.from.vo;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.gitee.chenyaohua.oa.anno.FilterField;
import com.gitee.chenyaohua.oa.from.dto.EncryptionType;
import com.gitee.chenyaohua.oa.from.validator.CheckVerificationCode;
import com.gitee.chenyaohua.oa.from.validator.ResetPasswordCheck;
import com.gitee.chenyaohua.oa.from.validator.UserRegistrationCheck;

import lombok.Data;


@Data
public class UserRegistrationFrom {

	@JsonProperty("userName")
	@NotBlank(groups = UserRegistrationCheck.class,message = "用户名不能是空")
	@Size(groups = UserRegistrationCheck.class,message = "用户名必须小于20个字符",max = 20)
    private String userName;

	@FilterField(type= EncryptionType.DESEDE)
	@JsonProperty("email")
	@NotBlank(groups = UserRegistrationCheck.class,message = "邮箱不能是空")
	@Size(groups = UserRegistrationCheck.class,message = "邮箱必须小于40个字符",max = 40)
	@Email(groups = UserRegistrationCheck.class,message = "邮箱不符合规则")
    private String userEmail;

	@FilterField(type= EncryptionType.MD5)
	@JsonProperty("oldPassword")
	@NotBlank(groups = {ResetPasswordCheck.class,UserRegistrationCheck.class},message = "密码不能是空")
	@Size(groups =  {ResetPasswordCheck.class,UserRegistrationCheck.class},message = "密码必须小于20个字符",max = 20,min=6)
	private String userPasswrod;

	@FilterField(type= EncryptionType.MD5)
	@JsonProperty("newPassword")
	@NotBlank(groups =  {ResetPasswordCheck.class,UserRegistrationCheck.class},message = "密码不能是空")
	@Size(groups = {ResetPasswordCheck.class,UserRegistrationCheck.class},message = "密码必须小于20个字符",max = 20,min=6)
	private String newPasswrod;
	
	private String userSex;

	@NotBlank(groups = UserRegistrationCheck.class,message = "验证码不能是空")
	@Pattern(regexp = "[0-9]{6}",groups = UserRegistrationCheck.class,message = "验证码必须是6位数字")
	private String code;

}
